home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / plain / contrib / setstrut.tex < prev    next >
Encoding:
Text File  |  1992-08-26  |  4.6 KB  |  59 lines

  1. %   SETSTRUT.TEX   Automatic strut computation                                  
  2. %   by Stephan v.\ Bechtolsheim   1987                                          
  3. % Save the current value of \baselineskip here for strut handling               
  4. \newdimen\strutskip                                                             
  5.                                                                                 
  6. % \setstrut                                                                     
  7. % =========                                                                     
  8. % Compute \strut as a \vrule of                                                 
  9. %   width: 0                                                                    
  10. %   height: 70% of the current value of \baselinekip                            
  11. %   depth: the remaining 30% of \baselineskip.                                  
  12. \def\setstrut {%                                                                
  13.     \strutskip = \baselineskip                                                  
  14.     \ifdim\baselineskip < 0pt                                                   
  15.          \errhelp = {You probably called \string\offinterlineskip               
  16.               before \string\setstrut}                                          
  17.          \errmessage{\string\setstrut: negative                                 
  18.               \string\baselineskip (\the\baselineskip)}%                        
  19.     \fi                                                                         
  20. }                                                                               
  21.                                                                                 
  22. % \strut                                                                        
  23. % ======                                                                        
  24. % The strut                                                                     
  25. \def\strut {%                                                                   
  26.     \vrule height 0.7\strutskip                                                 
  27.          depth 0.3\strutskip                                                    
  28.          width 0pt                                                              
  29. }                                                                               
  30.                                                                                 
  31. % \higherstrut                                                                  
  32. % ============                                                                  
  33. % Generate a strut, which is higher by #1 than the usual strut.                 
  34. % The depth is the depth of \strut.                                             
  35. % #1: dimension, by which the strut is made higher                              
  36. \def\higherstrut #1{%                                                           
  37.     {%                                                                          
  38.          \dimen0 = 0.7\strutskip                                                
  39.          \advance\dimen0 by #1%                                                 
  40.          \vrule height \dimen0 depth 0.3\strutskip width 0pt                    
  41.     }%                                                                          
  42. }                                                                               
  43.                                                                                 
  44. % \deeperstrut                                                                  
  45. % ============                                                                  
  46. % Generate a strut, which is deeper by #1 than the usual strut.                 
  47. % the height is the height of \strut.                                           
  48. % #1: dimension, by wghich the strut is made deeper.                            
  49. \def\deeperstrut #1{%                                                           
  50.     {%                                                                          
  51.          \dimen0 = 0.3\strutskip                                                
  52.          \advance\dimen0 by #1%                                                 
  53.          \vrule height 0.7\strutskip depth \dimen0 width 0pt                    
  54.     }%                                                                          
  55. }                                                                               
  56.                                                                                 
  57. % Initialize in case the user forgets to set up a strut                         
  58. \setstrut                                                                       
  59.